-
Notifications
You must be signed in to change notification settings - Fork 61
Upgrade schemars to 0.9 #4682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade schemars to 0.9 #4682
Conversation
dd12f94 to
a35db23
Compare
Deploying matrix-authentication-service-docs with
|
| Latest commit: |
db2288b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://eeffbb6d.matrix-authentication-service-docs.pages.dev |
| Branch Preview URL: | https://quenting-schemars-0-9.matrix-authentication-service-docs.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR upgrades the schemars library from version 0.8.22 to 0.9.0, along with the aide library from 0.14.2 to 0.15.1. The changes update the JSON Schema generation code to use the new API, migrate from the deprecated nullable approach to using type arrays with null, and adjust various schema attribute definitions. The upgrade also removes workarounds for old dependency version conflicts with indexmap and hashbrown.
Key Changes
- Upgraded
schemarsfrom 0.8.22 to 0.9.0 andaidefrom 0.14.2 to 0.15.1 - Migrated from
nullable: truetotype: ["string", "null"]pattern for optional fields in JSON schemas - Updated custom
JsonSchemaimplementations to use new API (json_schema!macro,Cow<'static, str>for schema names) - Changed
#[schemars(example = "function")]to#[schemars(example = &"value")]or#[schemars(example = value)]for inline values
Reviewed Changes
Copilot reviewed 20 out of 24 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Cargo.toml | Updated schemars to 0.9.0, aide to 0.15.1, changed schemars features from url, chrono to url2, chrono04, removed schemars feature from ipnetwork |
| Cargo.lock | Lockfile updates for dependency changes |
| deny.toml | Removed skip entries for old indexmap/hashbrown versions no longer needed |
| crates/policy/src/bin/schema.rs | Migrated schema settings API, removed option_nullable settings |
| crates/iana/src/oauth.rs | Updated JsonSchema implementations to use new API with json_schema! macro |
| crates/iana-codegen/src/generation.rs | Updated code generator to produce new schemars API code |
| crates/iana-codegen/src/main.rs | Added rustls crypto provider initialization |
| crates/iana-codegen/Cargo.toml | Added rustls dependency |
| crates/handlers/src/admin/v1/users/set_password.rs | Changed example attribute from function to static reference |
| crates/handlers/src/admin/v1/policy_data/set.rs | Changed example from function name to function call |
| crates/handlers/src/admin/schema.rs | Updated custom JsonSchema implementations for ULID and DeviceID types |
| crates/handlers/src/admin/mod.rs | Added transform to remove AddNullable for OpenAPI 3.1 compatibility |
| crates/config/src/sections/telemetry.rs | Removed example functions, inlined values in attributes |
| crates/config/src/sections/secrets.rs | Changed example from function to static reference |
| crates/config/src/sections/http.rs | Changed examples from functions to static references, added schema override for trusted_proxies |
| crates/config/src/schema.rs | Updated Hostname JsonSchema implementation |
| crates/config/src/bin/schema.rs | Migrated schema settings API |
| policies/schema/*.json | Updated to use type arrays instead of nullable, reordered required fields |
| docs/config.schema.json | Large schema regeneration with new format |
| docs/api/spec.json | API schema regeneration with new format |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
reivilibre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not too bad actually
| // valid with OpenAPI 3.1. For some reason, aide/schemars output | ||
| // an OpenAPI 3.1 schema with this nullable transform. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be reported & issue tracked here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it's an aide or a schemars thing… I can't really find related issues, but also there is a bunch of cleaning up happening on the aide side happening on the main branch; maybe we should just wait for the next release and see?
This upgrades schemars and aide to their latest versions.
This changes a little bit the generated config and adminapi schemas, but at a first glance nothing major.